{template 'public/header'}
{template 'public/comhead'}
<input type="hidden" name="schoolid" value="{$schoolid}" />
<div class="panel panel-info">
	<div class="panel-body">
	   {php echo $this -> set_tabbar($action1, $schoolid, $_W['role'], $_W['isfounder']);}
	</div>
</div>
<ul class="nav nav-tabs">
    <li {if $operation == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('template', array('op' => 'display', 'schoolid' => $schoolid))}">前端模板</a></li>
    <li {if $operation == 'display1'}class="active"{/if}><a href="{php echo $this->createWebUrl('template', array('op' => 'display1', 'schoolid' => $schoolid))}">首页按钮</a></li>
    <li {if $operation == 'display2'}class="active"{/if}><a href="{php echo $this->createWebUrl('template', array('op' => 'display2', 'schoolid' => $schoolid))}">学生中心</a></li>	
</ul>
 <style>
.cLine {overflow: hidden;padding: 5px 0;color:#000000;}
.alert {padding: 8px 35px 0 10px;text-shadow: none;-webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);-moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
background-color: #f9edbe;border: 1px solid #f0c36d;-webkit-border-radius: 2px;-moz-border-radius: 2px;border-radius: 2px;color: #333333;margin-top: 5px;}
.alert p {margin: 0 0 10px;display: block;}
.alert .bold{font-weight:bold;}
.school_option li:after{content: "";width:9px;height:16px;position:absolute;right:15px;top:15px;background: url({MODULE_URL}public/mobile/img/right_arrow.png) no-repeat;
background-position: center center;background-size: 9px 16px;}
 </style>
{if $operation == 'display'}
<div class="cLine">
    <div class="alert">
    <p><span class="bold">提醒：</span>模板管理功能仅限公众号主管理员与站长有权查看和编辑</br>   
    </p>
    </div>
</div>
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
		<div class="panel panel-info"><div class="panel-heading">模板管理</div>
			<div class="panel-body">
				<div class="form-group">	
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">公共模版</label>
					<div class="col-sm-2 col-lg-2">
						 <div class="input-group">					
							<input type="text" class="form-control" name="style1" value="{if !empty($logo['style1'])}{$logo['style1']}{else}greencom{/if}" />
							<div class="help-block">无需登录可以查看的页面目</br>录在addons/fm_jiaoyu/template/mobile/</br><span style="color:red;font-weight:bold;font-size:15px;">自定义模版，无特殊开发需求不要更改此项目</span></div>
						 </div>
					</div>
				</div>
				<div class="form-group">	
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">学生/家长中心</label>
					<div class="col-sm-2 col-lg-2">
						 <div class="input-group">					
							<input type="text" class="form-control" name="style2" value="{if !empty($logo['style2'])}{$logo['style2']}{else}students{/if}" />
							<div class="help-block">学生或家长登录才能查看的页面</br>目录在addons/fm_jiaoyu/template/mobile/</br><span style="color:red;font-weight:bold;font-size:15px;">自定义模版，无特殊开发需求不要更改此项目</span></div>
						 </div>
					</div>
					<div class="col-sm-2 col-lg-2" style="margin-left:200px">
						<div class="input-group">	
							<select class="form-control" name="userstyle">
								<option value="user" {if $logo['userstyle']== 'user'}selected{/if}>系统默认</option>
								<option value="newuser" {if $logo['userstyle']== 'newuser'}selected{/if}>自定义设计</option>
							</select>
							<div class="help-block">此选项用于切换学生家长个人中心页面样式</br>系统默认为旧版个人中心样式</br><span style="color:red;font-weight:bold;font-size:15px;">如选择自定义，点击本页上方学生中心按钮前往设计</span></div>
						</div>						
					</div>
				</div>
				<div class="form-group">	
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">教师中心</label>
					<div class="col-sm-2 col-lg-2">
						 <div class="input-group">					
							<input type="text" class="form-control" name="style3" value="{if !empty($logo['style3'])}{$logo['style3']}{else}teacher{/if}" />
							<div class="help-block">需要教师登录后才能查看的页面</br>目录在addons/fm_jiaoyu/template/mobile/</br><span style="color:red;font-weight:bold;font-size:15px;">自定义模版，无特殊开发需求不要更改此项目</span></div>
						 </div>
					</div>					
				</div>
			</div>
		</div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{elseif $operation == 'display1'}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
		<div class="panel panel-info"><div class="panel-heading">新模板首页按钮（只对greencom首页模板生效）</div>
			<table class="table table-hover">
				<thead class="navbar-inner">
				<tr>
					<th class="text-center" style="width:50px;">ID</th>
					<th class="text-center" style="width:150px;;">图标</th>
					<th class="text-center" style="width:50px">标题</th>
					<th class="text-center" style="width:300px;">链接</th>
					<th class="text-center" style="width:80px;">位置</th>
					<th class="text-center" style="width:50px;">排序</th>
					<th class="text-right" style="width:130px;">是否显示</th>
				</tr>
				</thead>
				<tbody>
				{loop $icons $item}
					<tr>
						<td class="text-center" style="width:50px;">{$item['id']}</td>
						<td class="text-center" style="width:60px;">	
							<img src="{php echo tomedia($item['icon']);}" style="width:40px !important;" />建议尺寸为80*80的图片
							<input type="text" class="form-control input-sm" name="iconurl[{$item['id']}]" value="{$item['icon']}" />
						</td>
						<td class="text-center" style="width:50px;">
							<input type="text" class="form-control input-sm" name="iconname[{$item['id']}]" value="{$item['name']}" />
						</td>
						<td style="width:300px; white-space:nowrap;overflow: visible">
							<div class="input-group">
								<input type="text" value="{$item['url']}" id = "url{$item['id']}" name="url[{$item['id']}]" class="form-control" autocomplete="off">
								<span class="input-group-btn">
									<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">选择链接 <span class="caret"></span></button>
									<ul class="dropdown-menu">
										<li><a href="javascript:" data-type="jiaoyu" onclick="showJiaoyuDialog('url{$item['id']}',1);">微教育菜单</a></li>
										<li><a href="javascript:" data-type="system" onclick="showLinkDialog(this);">系统菜单</a></li>
										<li><a href="javascript:" data-type="page" onclick="pageLinkDialog(this);">微页面</a></li>
										<li><a href="javascript:" data-type="article" onclick="articleLinkDialog(this)">文章及分类</a></li>
										<li><a href="javascript:" data-type="news" onclick="newsLinkDialog(this)">图文回复</a></li>
										<li><a href="javascript:" data-type="map" onclick="mapLinkDialog(this)">一键导航</a></li>
										<li><a href="javascript:" data-type="phone" onclick="phoneLinkDialog(this)">一键拨号</a></li>
									</ul>
								</span>
							</div>
						</td>
						<td class="text-center" style="width:80px;">{if $item['place'] == 1}首页{elseif $item['place'] == 2}中部图标{elseif $item['place'] == 3}魔方{elseif $item['place'] == 4}下方列表{/if}</td>
						<td class="text-center" style="width:50px;">
							<input type="text" class="form-control input-sm" name="ssort[{$item['id']}]" value="{$item['ssort']}" />
						</td>
						<td class="text-right" style="width:130px;">
							<input type="checkbox" value="{$item['status']}" name="status[]" data-id="{$item['id']}" {if $item['status'] == 1}checked{/if}>
						</td>
					</tr>
				{/loop}
				</tbody>
			</table>
		</div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>		
	</form>
{template 'public/link'}	
<script type="text/javascript">	
require(['jquery.qrcode', 'bootstrap.switch'], function($){
	$(':checkbox[name="status[]"]').bootstrapSwitch();
	$(':checkbox[name="status[]"]').on('switchChange.bootstrapSwitch', function(e, state){
		var status = this.checked ? 1 : 2;
		var id = $(this).attr('data-id');
		$.post("{php echo $this->createWebUrl('template', array('op' => 'change','schoolid' => $schoolid))}", {id: id,status: status}, function(resp){
			setTimeout(function(){
			}, 500)
		});
	});	
});
</script>	
</div>
{elseif $operation == 'display2'}
<link href="{MODULE_URL}public/web/css/app.css" rel="stylesheet">
<style>
.deleteImage {background: url(http://weimeizhan.oss-cn-shenzhen.aliyuncs.com/public/mobile/img/deleteImage.png); background-size: 20px;display: inline;float: ;right:-8px;height: 20px;position: absolute;width: 20px;z-index: 4;top: 0px;}
.deleteImages {background: url(http://weimeizhan.oss-cn-shenzhen.aliyuncs.com/public/mobile/img/deleteImage.png); background-size: 20px;display: inline;float: ;right:0px;height: 20px;position: absolute;width: 20px;z-index: 4;top: 0px;}
.item:hover {cursor:pointer; overflow:hidden;background-color: #e0e6e6;color:#e0e6e6;box-sizing: border-box;}
.mofang:hover {background-color: #e0e6e6 !important;color:#e0e6e6 !important;}
.parent_weekPlan:hover {background-color: #e0e6e6 !important;color:#e0e6e6;}
.item:not([selected]) .deleteImage{display:none!important;}
.item:not([pinned]):hover .deleteImage{display:inherit!important;}
.mofang:not([selected]) .deleteImages{display:none!important;}
.mofang:not([pinned]):hover .deleteImages{display:inherit!important;}
.parent_weekPlan:not([selected]) .deleteImage{display:none!important;}
.parent_weekPlan:not([pinned]):hover .deleteImage{display:inherit!important;}
.parent_notify{padding: 12px 0 12px 25px;background:url({MODULE_URL}public/mobile/img/parent_notify_icon.png) no-repeat #fff;background-size:19px 15px;background-position:15px center;color:#999;border-top: 1px solid #f0f0f2;margin-bottom: 10px;text-indent: 1em;}
.app .app-preview .app-header{height:70px; background:url('../web/resource/images/app/iphone_head.png') center center no-repeat;}
</style>
<link rel="stylesheet" type="text/css" href="{OSSURL}public/mobile/css/parent_index.css">
<div class="cLine">
    <div class="alert">
    <p><span class="bold">提醒：</span>某些功能自定义名称在这里选中后前端将以此页面为准，后端菜单为自定义命名，如实时画面系统等</br>   
   <strong><font color='red'>特别提醒: 当你在前端学生家长个人中心启用自定义模板的时候才能使用本自定模板!</font></strong></br>
   <strong><font style="color:#641DBF;">本页涉及到的教育菜单链接需要实现开启相应功能后才可使用，否则仅仅这里设置后无效，例如考勤功能等</font></strong>
    </p>
    </div>
</div>
<div class="main">
<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
		<div class="app clearfix">
			<div class="app-preview">
				<div class="app-header"></div>
				{template 'public/newpage'}
				<div class="app-region">
					<div class="arrow-top"></div>
					<div class="panel panel-default">
						<div class="panel-body">
							<h4 style="min-height:10px;padding-top: 5px;" class="text-center">新增组件</h4>
							<ul class="app-add-filed clearfix" style="padding-top: 5px;">
								<li class="ng-scope"><a id="top" style="min-width:70px;" class="btn btn-primary ng-binding">顶部图标</a></li>
								<li class="ng-scope"><a id="mof" style="min-width:70px;" class="btn btn-primary ng-binding">魔方组件</a></li>
								<li class="ng-scope"><a id="dibu" style="min-width:70px;" class="btn btn-primary ng-binding">底部列表</a></li>
							</ul>
						</div>
					</div>
				</div>				
			</div>
			<div class="app-side">
				{template 'public/diychose'}
			</div>
			<div class="shop-preview col-xs-12 col-sm-9 col-lg-10">
				<div class="text-center alert alert-warning"  style="padding: 25px;height:60px;margin-bottom: 10px;border: 1px solid transparent;    border-radius: 4px;">
					<input style="top: -10px;" type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
					<input type="hidden" name="schoolid" value="{$schoolid}" />
					<input type="hidden" name="weid" value="{$weid}" />
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>
			</div>
		</div>
</form>
<script type="text/javascript"> 
function deleteclass(elm,id,type) {
	if(type == 1){
		$(elm).parent().parent().parent().remove();
		$("#iconeditor"+id).remove();			
	}
	if(type == 2){
		$(elm).parent().remove();
		$("#iconeditor"+id).remove();			
	}
	if(type == 3){
		$(elm).parent().remove();
		$("#iconeditor"+id).remove();			
	}
}
function del(elm,id,type) {
	var id = id;
	var truthBeTold = window.confirm('确认要删除已保存的按钮吗 ?'); 
	var url = "{php echo $this->createWebUrl('template',array('op'=>'delclass','schoolid' => $schoolid))}";
	var submitData = {
			id:id,
	};
	if (truthBeTold) {
		$.post(url, submitData, function(data) {
			if (data.result) {
				if(type == 1){
					$(elm).parent().parent().parent().remove();
					$("#iconeditor"+id).remove();			
				}
				if(type == 2){
					$(elm).parent().remove();
					$("#iconeditor"+id).remove();
				}
				if(type == 3){
					$(elm).parent().remove();
					$("#iconeditor"+id).remove();			
				}
			}else{
			   alert(data.msg);
			}
		},'json');
	}
}

$(document).on('click', '.delmf', function(){
	$(this).parent().remove();
	return false;
});
var imgruls = "{MODULE_URL}public/mobile/img/";
</script> 
{template 'public/toplist'}
{template 'public/mflist'}
{template 'public/dblist'}
<script type="text/javascript"> 		
		//处理临时增加的右侧显示
		$(document).ready(function() {
			$(".editor").hide();
		});
		function shouweditor(id) {
			//++divid;
			$(".editor").hide();
			$("#iconeditor"+id).show();
		}
		//结束处理

require(['jquery.qrcode', 'bootstrap.switch'], function($){
	$(':checkbox[name="status[]"]').bootstrapSwitch();
	$(':checkbox[name="status[]"]').on('switchChange.bootstrapSwitch', function(e, state){
		var status = this.checked ? 1 : 2;
		var id = $(this).attr('data-id');
		$.post("{php echo $this->createWebUrl('template', array('op' => 'change','schoolid' => $schoolid))}", {id: id,status: status}, function(resp){
			setTimeout(function(){
			}, 500)
		});
	});	
});		
</script>
<script type="text/javascript"> 
function SwapTxt(btn)  {
	  if(btn){
		  var txt = document.getElementById("btnname"+btn).value;
		  document.getElementById("iconname"+btn).innerHTML=txt;
		  document.getElementById("btnname"+btn).value=txt;
	  }
}
function SwapTxt1(btn)  {
	  if(btn){
		  var txt = document.getElementById("btnname"+btn).value;
		  document.getElementById("iconname"+btn).innerHTML=txt;
		  document.getElementById("btnname"+btn).value=txt;
	  }
}
function SwapTxt2(btn)  {
	  if(btn){
		  var txt = document.getElementById("mfbzs"+btn).value;
		  document.getElementById("mfbz"+btn).innerHTML=txt;
		  document.getElementById("mfbzs"+btn).value=txt;
	  }
}
function SwapTxt3(btn)  {
	  if(btn){
		  var txt = document.getElementById("lbnames"+btn).value;
		  document.getElementById("lbname"+btn).innerHTML=txt;
		  document.getElementById("lbnames"+btn).value=txt;
	  }
}
</script>
{template 'public/link'}	
</div>
{/if}
{template 'web/common'}
{template 'public/footer'}